﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StyleMVVM.Data.Activation;
using StyleMVVM.DotNet.Aspects.Impl;
using StyleMVVM.DotNet.Aspects.UnitTests.Classes;

namespace StyleMVVM.DotNet.Aspects.UnitTests.Impl
{
	[TestClass]
	public class AspectClassManagerTests : BaseTestClass
	{
		[TestMethod]
		public void AugmentAttributedType()
		{
			Type newType = AspectClassManager.Instance.GetAspectedType(typeof(AttributedObject));

			AttributedObject attributedObject = Activator.CreateInstance(newType) as AttributedObject;

			ICustomInitialization customInitialization = attributedObject as ICustomInitialization;

			customInitialization.CustomInitialization(Container, Container.CreateInjectionContext());

			Assert.IsNotNull(attributedObject);

			SimpleAspect.InvokeCount = 0;

			attributedObject.Calculate(4, 5);

			Assert.AreEqual(1, SimpleAspect.InvokeCount);
		}
	}
}
